local Theorem = {}

--获取玩家模式胜负场
---@param room Room @ 房间
---@param player ServerPlayer @ 玩家
---@param mode string @ 模式
---@return playerdate table@ 玩家数据
Theorem.getModeWinLosedata=function (room,player,mode)
    local modename=room.settings.gameMode
    room.settings.gameMode=mode
    room.room:updatePlayerWinRate(player.id, mode, "rebel", 0)--随便更新一下
    local playerdata=player._splayer:getGameData()
    local tot, win = playerdata:at(0), playerdata:at(1)
    local ret = {tot, win}
    room.settings.gameMode=modename--恢复
    return ret
  end



--获取玩家宝珠，初始10宝珠,并标记到玩家
Theorem.getplayerhufu=function (room,player)
  if player.id < 0 then return 0 end
  --if player:getMark("@!!pve_baozhu")>0 then return player:getMark("@!!pve_baozhu") end
  local room=player.room
  local save="hufu_save"
  local sdata=player:getGlobalSaveState(save)

  if #sdata == 0 then
    sdata = {10}
  end

  local money=sdata[1]

  --若money==0则初始化
  local baozhu=money

  if baozhu>0 then
    room:setPlayerMark(player,"@!!pve_baozhu",baozhu)
  end
  return  baozhu
end


--改变玩家虎符，最低降到0
---@param room Room @ 房间
---@param player ServerPlayer @ 玩家
---@param change intger @ 改变量
Theorem.changeplayerhufu=function (room,player,change)
  local room=player.room
  local save="hufu_save"
  local sdata=player:getGlobalSaveState(save)
  if #sdata == 0 then
    sdata = {10}
  end
  local money=sdata[1]
  local num=change
  money=money+num
  money=math.max(0,money)--至少为0
  player:saveGlobalState(save, {money})
  return money
end
  









  return Theorem